package {
	
	import de.ghost23.common.statemachine.StateMachineEvent;

	import flash.display.Sprite;
	import xmlStateMachine.XMLStateMachine;

	public class StateMachineTest extends Sprite {

		public function StateMachineTest() {

			var mySM:XMLStateMachine = new XMLStateMachine();

			mySM.addEventListener(StateMachineEvent.NEW_STATE, function(event:StateMachineEvent):void {
				trace("State XMLStates.XML_PARSED is reached!");
				mySM.removeEventListener(StateMachineEvent.NEW_STATE, arguments.callee);
			});

			mySM.addEventListener(StateMachineEvent.AIMED_STATE_REACHED, function(event:StateMachineEvent):void {
				trace("New state reached -> " + event.currentState.identifier);
				mySM.removeEventListener(StateMachineEvent.AIMED_STATE_REACHED, arguments.callee);
			});

			mySM.init();
			//mySM.aimForState(XMLStates.XML_PARSED);
			mySM.injectNewFileUrl("sample.xml");
		}
	}
}
